<!-- 
  computed()

    const 计算属性的数据 = computed(getter)

    const 计算属性的数据 = computed({
      get() {

      },

      set(value) {

      }
    })
 -->

<template>
  <div>
    <h1>App</h1>
    <p>{{ count }}</p>
    <p>{{ plusOne }}</p>
    <button @click="plusTwo++">{{ plusTwo }}</button>
  </div>
</template>

<script>
import { ref, computed } from 'vue'

export default {
  setup() {
    const count = ref(1)
    const plusOne = computed(() => count.value + 1)

    const plusTwo = computed({
      get: () => count.value + 1,
      set: (val) => {
        count.value = val - 1
      }
    })

    return {
      count,
      plusOne,
      plusTwo
    }
  }
}
</script>
